package controller;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import sql.UserStoryDao;
import beans.UserStoryTypesBean;

/**
 * Servlet implementation class GetUserStoryTypes
 */
@WebServlet("/GetUserStoryTypes")
public class GetUserStoryTypes extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public GetUserStoryTypes() {
        super();
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		UserStoryDao userStoryDao = new UserStoryDao();
		try {
			UserStoryTypesBean userStoryTypesBean = userStoryDao.getUserStoryTypes();
			PrintWriter out = response.getWriter();
			out.write(userStoryTypesBean.getJson());
		} catch (ClassNotFoundException | SQLException e) {
			e.printStackTrace();
		}
	}

}
